home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / p / pcqpascalv1.2d.lha / Examples2 / StormWizard / Test.p next >
Encoding:
Text File  |  1997-05-11  |  2.4 KB  |  101 lines

  1. PROGRAM test;
  2.  
  3. { Testprogramm für die Anbindung von "StormWizard" an "MaxonPascal" /
  4.   "KickPascal" (geschrieben unter KP2.12 (mit OS3-Includes))
  5.  
  6.   $VER:              1.2 (02.06.96)
  7.  
  8.   Autor:             Falk Zühlsdorff (ai036@rz.tu-ilmenau.de)
  9.                      P.U.R.I.T.Y.-Pascal-FD, Amiga Zentrum Thüringen e.V.
  10.  
  11.                      PCQ Pascal version Nils Sjoholm (nils.sjoholm@mailbox.swipnet.se)
  12.  
  13. }
  14. {$I "Include:Exec/Ports.i"}
  15. {$I "Include:Exec/Libraries.i"}
  16. {$I "Include:Libraries/wizard.i"}
  17.  
  18. CONST
  19.     StartPath = "ram:Test.wizard";
  20. {
  21.     This is just a quick hack to see if it works.
  22.     Remember to put Test.wizard in ram: or change the
  23.     path above.
  24. }
  25.  
  26. VAR MySurface      : Address;
  27.     WBScreen       : ScreenPtr;
  28.     MyWinHandle    : WizardWindowHandlePtr;
  29.     Tags           : ARRAY[0..2] OF TagItem;
  30.  
  31.     MyNewWindow    : NewWindowPtr;
  32.     MyWindow       : WindowPtr;
  33.     MyGadgets      : ARRAY[0..2] OF GadgetPtr;
  34.  
  35.     Msg            : IntuiMessagePtr;
  36.     ex             : boolean;
  37.     hlp            : integer;
  38.  
  39. PROCEDURE CleanUp;
  40. BEGIN
  41.  IF MyWindow<>NIL      THEN WZ_CloseWindow(MyWinHandle);
  42.  IF MyWinHandle<>NIL   THEN WZ_FreeWindowHandle(MyWinHandle);
  43.  IF MySurface<>NIL     THEN WZ_CloseSurface(MySurface);
  44.  IF WBScreen<>NIL      THEN UnlockPubScreen(NIL,WBScreen);
  45.  IF WizardBase<>NIL    THEN CloseLibrary(WizardBase);
  46.  exit(0);
  47. END;
  48.  
  49. BEGIN
  50.  
  51.  
  52.  MySurface:=NIL;MyWinHandle:=NIL;MyNewWindow:=NIL;MyWindow:=NIL;WBScreen:=NIL;
  53.  
  54.  WizardBase:=OpenLibrary("wizard.library",0);
  55.  IF WizardBase = NIL THEN CleanUp;
  56.  WBScreen:=LockPubScreen("Workbench");
  57.  IF WBScreen<>NIL
  58.   THEN
  59.    BEGIN
  60.      MySurface:=WZ_OpenSurfaceA(StartPath,NIL,NIL);
  61.      IF MySurface=NIL THEN BEGIN CleanUp;END;
  62.  
  63.      MyWinHandle:=WZ_AllocWindowHandleA(WBScreen,0,MySurface,NIL);
  64.      IF MySurface=NIL THEN BEGIN CleanUp;END;
  65.  
  66.      Tags[0].ti_tag:=WWH_GadgetArray;
  67.      Tags[0].ti_Data:=Integer(MyGadgets);
  68.      Tags[1].ti_tag:=TAG_DONE;
  69.  
  70.      MyNewWindow:=WZ_CreateWindowObjA(MyWinHandle,1,@Tags);
  71.      IF MyNewWindow=NIL THEN BEGIN CleanUp;END;
  72.  
  73.      MyWindow:=WZ_OpenWindowA(MyWinHandle,MyNewWindow,NIL);
  74.      IF MyWindow=NIL THEN BEGIN CleanUp;END;
  75.  
  76.      ex:=false;
  77.      REPEAT
  78.       Msg:=IntuiMessagePtr(WaitPort(MyWindow^.UserPort));
  79.       Msg:=IntuiMessagePtr(GetMsg(MyWindow^.Userport));
  80.       IF Msg<>NIL
  81.          THEN
  82.           BEGIN
  83.            ReplyMsg(MessagePtr(Msg));
  84.            IF  Msg^.Class=IDCMP_CLOSEWINDOW THEN ex:=true;
  85.           END;
  86.  
  87.      UNTIL ex;
  88.    END;
  89.  
  90.  CleanUp;
  91. END.
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.